<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <script src="./lib/vue-2.4.0.js"></script>
        <link rel="stylesheet" href="./lib/animate.css">
        <!-- 入场 bounceIn 离场 bounceOut -->
    </head>

    <body>
        <div id="app">
            <input type="button" value="toggle" @click="flag=!flag">
            <!-- 需求：点击按钮，让h3显示， 再点击，让h3隐藏 -->
            <!-- <transition enter-active-class="animate bounceIn" leave-active-class="animate bounceOut">
                <h3 v-if="flag">这是一个H3</h3>
            </transition> -->

            <!-- 使用 :duration="毫秒值" 来统一设置入场和离场时候的动画时长 -->
            <!-- <transition enter-active-class="bounceIn" leave-active-class="bounceOut" :duration="400">
                <h3 v-if="flag">这是一个H3</h3>
            </transition> -->

            <!-- 使用 :duration="{ enter:200, leave:400 }" 来设置入场时长和离场时长 -->
            <transition 
            enter-active-class="bounceIn" 
            leave-active-class="bounceOut" 
            :duration="{ enter:200, leave:400 }">
                <h3 v-if="flag">这是一个H3</h3>
            </transition>
        </div>

        <script>
            // 创建 Vue 实例，得到 ViewModel
            var vm = new Vue({
                el: '#app',
                data: {
                    flag: false
                },
                methods: {}
            });
        </script>
    </body>
</html>